using System;
using System.Diagnostics;
using System.Threading;
namespace AppToolKit.Core.Utils
{
	public class ProcessHelper
	{
		public static void KillProcess(string processName)
		{
			Process[] processesByName = Process.GetProcessesByName(processName);
			Process[] array = processesByName;
			for (int i = 0; i < array.Length; i++)
			{
				Process process = array[i];
				process.Kill();
			}
			while (true)
			{
				processesByName = Process.GetProcessesByName(processName);
				if (processesByName.Length <= 0)
				{
					break;
				}
				Thread.Sleep(10000);
			}
		}
		public static void StartProcess(string filePath)
		{
			if (Process.Start(filePath) == null)
			{
				throw new ApplicationException("启动程序失败");
			}
		}
	}
}
